package com.desire.consumer;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class FanoutConsumer {

    /**
     * 监听队列1
     *
     * @param message 对列中的消息
     */
    @RabbitListener(queues = {"mq-queue-one"})
    public void handlerQueueOne(Message message) {
        System.out.println("从队列[mq-queue-one]中获得消息:" + new String(message.getBody()));
    }

    /**
     * 监听队列2
     *
     * @param message 对列中的消息
     */
    @RabbitListener(queues = {"mq-queue-two"})
    public void handlerQueueTwo(Message message) {
        System.out.println("从队列[mq-queue-two]中获得消息:" + new String(message.getBody()));
    }
}
